home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML Instance.sea / XML Instance / Required / plugins / HTMLWindow.jar / horst / TableView.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-03-18  |  22.9 KB  |  1,257 lines

  1. package horst;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Graphics;
  5. import java.awt.Rectangle;
  6. import java.awt.Shape;
  7. import java.util.Enumeration;
  8. import java.util.Vector;
  9.  
  10. public class TableView extends BlockView {
  11.    static final int TOP_VALIGN = 0;
  12.    static final int MIDDLE_VALIGN = 1;
  13.    static final int BOTTOM_VALIGN = 2;
  14.    static final int BASELINE_VALIGN = 3;
  15.    private static final int PREFWIDTH = 0;
  16.    private static final int MINWIDTH = 1;
  17.    private static final int LAYOUT = 2;
  18.    View[] m_topCaptions;
  19.    View[] m_bottomCaptions;
  20.    boolean[] m_hasSingleCell;
  21.    int[] m_prefColWidths;
  22.    int[] m_minColWidths;
  23.    int[] m_colWidths;
  24.    int[] m_colSpecWidths;
  25.    int[] m_rowHeightSpecs;
  26.    float[] m_pctColWidths;
  27.    boolean m_bHavePctColumns;
  28.    boolean m_bPrefMinColsComputed = false;
  29.    Rectangle m_tableBorder;
  30.    float m_pctValue;
  31.    Color m_bgColor;
  32.    int m_nColumns;
  33.    int m_nRows;
  34.    int m_nDefinedRows;
  35.    int m_cellPadding;
  36.    int m_cellSpacing;
  37.    int m_borderSize;
  38.    int m_width;
  39.    int m_height;
  40.  
  41.    public TableView(View parent, Element e, HTMLPane container) {
  42.       super(parent, e, container);
  43.    }
  44.  
  45.    boolean allMinimum(int[] cols) {
  46.       for(int i = 0; i < cols.length; ++i) {
  47.          if (cols[i] > this.m_minColWidths[i]) {
  48.             return false;
  49.          }
  50.       }
  51.  
  52.       return true;
  53.    }
  54.  
  55.    boolean allSpecWidths(int[] cols) {
  56.       for(int i = 0; i < cols.length; ++i) {
  57.          if (this.m_colSpecWidths[i] != -1 && cols[i] > this.m_minColWidths[i] && cols[i] > this.m_colSpecWidths[i]) {
  58.             return false;
  59.          }
  60.       }
  61.  
  62.       return true;
  63.    }
  64.  
  65.    void checkWidthSpecification(int width) {
  66.       int diff = 0;
  67.       int span = 0;
  68.       if (this.m_width != -1) {
  69.          span = this.getColumnSum(this.m_colWidths);
  70.          int specWidth = this.m_width;
  71.          specWidth -= 2 * this.m_borderSize;
  72.          specWidth -= 2 * this.m_cellSpacing + (this.m_nColumns - 1) * this.m_cellSpacing;
  73.          if (specWidth > span) {
  74.             diff = specWidth - span;
  75.          }
  76.       } else if (this.m_pctValue > 0.0F && this.m_pctValue <= 1.0F) {
  77.          span = this.getColumnSum(this.m_colWidths);
  78.          diff = Math.max(0, width - span);
  79.       }
  80.  
  81.       if (diff > 0) {
  82.          int runningTotal = 0;
  83.          int addAmount = 0;
  84.  
  85.          for(int i = 0; i < this.m_colWidths.length; ++i) {
  86.             if (i == this.m_colWidths.length - 1) {
  87.                addAmount = diff - runningTotal;
  88.             } else {
  89.                double pct = (double)this.m_colWidths[i] / (double)span;
  90.                addAmount = (int)(pct * (double)diff);
  91.             }
  92.  
  93.             int[] var10000 = this.m_colWidths;
  94.             var10000[i] += addAmount;
  95.             runningTotal += addAmount;
  96.          }
  97.       }
  98.  
  99.    }
  100.  
  101.    protected boolean columnOccupied(Vector v, int row, int col) {
  102.       Enumeration e = v.elements();
  103.  
  104.       while(e.hasMoreElements()) {
  105.          RowSpanColumns x = (RowSpanColumns)e.nextElement();
  106.          if (row <= x.endRow) {
  107.             for(int i = 0; i < x.columns.length; ++i) {
  108.                if (x.columns[i] == col) {
  109.                   return true;
  110.                }
  111.             }
  112.          }
  113.       }
  114.  
  115.       return false;
  116.    }
  117.  
  118.    int[] computeColumnWidths(int width, int mode) {
  119.       int[] widths = new int[this.m_nColumns];
  120.  
  121.       for(int pass = 0; pass < 2; ++pass) {
  122.          if (mode == 0) {
  123.             widths = Utilities.clone(this.m_prefColWidths);
  124.          } else if (mode == 1) {
  125.             widths = Utilities.clone(this.m_minColWidths);
  126.          } else {
  127.             widths = pass == 0 ? Utilities.clone(this.m_prefColWidths) : Utilities.clone(this.m_minColWidths);
  128.          }
  129.  
  130.          for(int row = 0; row < super.m_children.length; ++row) {
  131.             View[] cells = ((TableRow)super.m_children[row]).m_children;
  132.  
  133.             for(int cellNum = 0; cellNum < cells.length; ++cellNum) {
  134.                TableCell cell = (TableCell)cells[cellNum];
  135.                if (cell.m_colSpan > 1) {
  136.                   int startCol = cell.m_startColumn;
  137.                   int endCol = cell.m_endColumn;
  138.                   int spanWidth = 0;
  139.  
  140.                   for(int j = startCol; j <= endCol; ++j) {
  141.                      spanWidth += widths[j];
  142.                   }
  143.  
  144.                   int cellSpan = 0;
  145.                   if (mode == 1) {
  146.                      cellSpan = cell.getMinimumSpan(1);
  147.                   } else if (mode == 0) {
  148.                      cellSpan = cell.getPreferredSpan(1);
  149.                   } else {
  150.                      cellSpan = pass == 0 ? cell.getPreferredSpan(1) : cell.getMinimumSpan(1);
  151.                   }
  152.  
  153.                   if (cellSpan > spanWidth) {
  154.                      widths = this.distributeSpace(widths, startCol, endCol, cellSpan - spanWidth);
  155.                   }
  156.                }
  157.             }
  158.          }
  159.  
  160.          if (mode == 0 || mode == 1) {
  161.             return widths;
  162.          }
  163.  
  164.          if (pass == 0 && this.getColumnSum(widths) <= width) {
  165.             return widths;
  166.          }
  167.       }
  168.  
  169.       int diff = width - this.getColumnSum(widths);
  170.       if (diff > 0) {
  171.          widths = this.distributeSpace(widths, 0, widths.length - 1, diff);
  172.       }
  173.  
  174.       return widths;
  175.    }
  176.  
  177.    int[] computePercentColumnWidths(int width) {
  178.       float[] pctValues = new float[this.m_pctColWidths.length];
  179.       float totalPctCols = 0.0F;
  180.       int nNonPctCols = 0;
  181.  
  182.       for(int i = 0; i < pctValues.length; ++i) {
  183.          pctValues[i] = this.m_pctColWidths[i];
  184.          if (pctValues[i] > 0.0F) {
  185.             totalPctCols += pctValues[i];
  186.          } else {
  187.             ++nNonPctCols;
  188.          }
  189.       }
  190.  
  191.       float nonPctCols = 1.0F - totalPctCols;
  192.       int[] widths = new int[this.m_nColumns];
  193.  
  194.       for(int i = 0; i < this.m_nColumns; ++i) {
  195.          widths[i] = Math.max(this.m_colSpecWidths[i], this.m_minColWidths[i]);
  196.       }
  197.  
  198.       int layoutWidth = this.computeRequiredLayoutWidth(pctValues, totalPctCols, this.m_minColWidths);
  199.       int availWidth = width;
  200.       if (this.m_width != -1 || this.m_pctValue > 0.0F && this.m_pctValue <= 1.0F) {
  201.          if (this.m_width != -1) {
  202.             availWidth = this.m_width;
  203.          } else {
  204.             availWidth = (int)(this.m_pctValue * (float)width);
  205.          }
  206.  
  207.          if (layoutWidth < availWidth) {
  208.             layoutWidth = availWidth;
  209.          }
  210.       }
  211.  
  212.       if (layoutWidth < availWidth) {
  213.          int prefLayoutWidth = this.computeRequiredLayoutWidth(pctValues, totalPctCols, this.m_prefColWidths);
  214.          if (prefLayoutWidth <= availWidth) {
  215.             layoutWidth = prefLayoutWidth;
  216.          } else {
  217.             layoutWidth = availWidth;
  218.          }
  219.       }
  220.  
  221.       if (layoutWidth <= width) {
  222.          int tabWidth = layoutWidth;
  223.          int totPctSpace = 0;
  224.  
  225.          for(int i = 0; i < pctValues.length; ++i) {
  226.             if ((double)pctValues[i] > (double)0.0F) {
  227.                widths[i] = (int)(pctValues[i] * (float)tabWidth);
  228.                totPctSpace += widths[i];
  229.             }
  230.          }
  231.  
  232.          int space = Math.max(0, tabWidth - totPctSpace);
  233.  
  234.          while(nNonPctCols > 0 && space > 0) {
  235.             boolean bColsAvailable = false;
  236.  
  237.             for(int i = 0; i < this.m_nColumns; ++i) {
  238.                if ((double)pctValues[i] <= (double)0.0F && this.m_colSpecWidths[i] == -1 || widths[i] < this.m_colSpecWidths[i]) {
  239.                   bColsAvailable = true;
  240.                   break;
  241.                }
  242.             }
  243.  
  244.             if (!bColsAvailable) {
  245.                break;
  246.             }
  247.  
  248.             for(int i = 0; i < pctValues.length && space > 0; ++i) {
  249.                if ((double)pctValues[i] <= (double)0.0F) {
  250.                   int var10002 = widths[i]++;
  251.                   --space;
  252.                }
  253.             }
  254.          }
  255.  
  256.          int overshoot = this.getColumnSum(widths) - tabWidth;
  257.          if (overshoot > 0) {
  258.             boolean bAllMinimum = this.allMinimum(widths);
  259.             boolean bAllSpecWidths = this.allSpecWidths(widths);
  260.  
  261.             while(!bAllMinimum && overshoot > 0) {
  262.                for(int i = 0; i < widths.length && overshoot > 0; ++i) {
  263.                   if (!bAllSpecWidths) {
  264.                      if (this.m_colSpecWidths[i] != -1 && widths[i] > this.m_colSpecWidths[i] && widths[i] > this.m_minColWidths[i]) {
  265.                         int var32 = widths[i]--;
  266.                         --overshoot;
  267.                      }
  268.                   } else if (widths[i] > this.m_minColWidths[i]) {
  269.                      int var33 = widths[i]--;
  270.                      --overshoot;
  271.                   }
  272.                }
  273.  
  274.                bAllMinimum = this.allMinimum(widths);
  275.                if (!bAllSpecWidths) {
  276.                   bAllSpecWidths = this.allSpecWidths(widths);
  277.                }
  278.             }
  279.          } else {
  280.             space = Math.abs(overshoot);
  281.  
  282.             while(space > 0) {
  283.                for(int i = 0; i < pctValues.length && space > 0; ++i) {
  284.                   if ((double)pctValues[i] > (double)0.0F) {
  285.                      int var34 = widths[i]++;
  286.                      --space;
  287.                   }
  288.                }
  289.             }
  290.          }
  291.       } else {
  292.          for(int i = 0; i < pctValues.length; ++i) {
  293.             if ((double)pctValues[i] > (double)0.0F) {
  294.                widths[i] = Math.max(this.m_minColWidths[i], (int)(pctValues[i] * (float)width));
  295.             } else {
  296.                widths[i] = Math.max(this.m_colSpecWidths[i], this.m_minColWidths[i]);
  297.             }
  298.          }
  299.  
  300.          int overshoot = this.getColumnSum(widths) - width;
  301.          if (overshoot < 0) {
  302.             int space = Math.abs(overshoot);
  303.  
  304.             while(nNonPctCols > 0 && space > 0) {
  305.                for(int i = 0; i < pctValues.length; ++i) {
  306.                   if ((double)pctValues[i] <= (double)0.0F) {
  307.                      int var35 = widths[i]++;
  308.                      --space;
  309.                   }
  310.                }
  311.             }
  312.          } else {
  313.             boolean bAllMinimum = this.allMinimum(widths);
  314.             boolean bAllSpecWidths = this.allSpecWidths(widths);
  315.  
  316.             while(!bAllMinimum && overshoot > 0) {
  317.                for(int i = 0; i < widths.length && overshoot > 0; ++i) {
  318.                   if (!bAllSpecWidths) {
  319.                      if (this.m_colSpecWidths[i] != -1 && widths[i] > this.m_colSpecWidths[i]) {
  320.                         int var36 = widths[i]--;
  321.                         --overshoot;
  322.                      }
  323.                   } else if (widths[i] > this.m_minColWidths[i]) {
  324.                      int var37 = widths[i]--;
  325.                      --overshoot;
  326.                   }
  327.                }
  328.  
  329.                bAllMinimum = this.allMinimum(widths);
  330.                if (!bAllSpecWidths) {
  331.                   bAllSpecWidths = this.allSpecWidths(widths);
  332.                }
  333.             }
  334.          }
  335.       }
  336.  
  337.       return widths;
  338.    }
  339.  
  340.    void computePrefMinWidths() {
  341.       if (!this.m_bPrefMinColsComputed) {
  342.          this.m_bPrefMinColsComputed = true;
  343.          this.m_hasSingleCell = new boolean[this.m_nColumns];
  344.          this.m_prefColWidths = new int[this.m_nColumns];
  345.          this.m_minColWidths = new int[this.m_nColumns];
  346.  
  347.          for(int col = 0; col < this.m_nColumns; ++col) {
  348.             boolean bFoundSingleCell = false;
  349.  
  350.             for(int row = 0; row < super.m_children.length; ++row) {
  351.                TableRow rv = (TableRow)super.m_children[row];
  352.                TableCell cell = rv.getTableColumn(col);
  353.                if (cell != null) {
  354.                   this.m_prefColWidths[col] = Math.max(this.m_prefColWidths[col], cell.getPreferredSpan(1));
  355.                   this.m_minColWidths[col] = Math.max(this.m_minColWidths[col], cell.getMinimumSpan(1));
  356.                   bFoundSingleCell = true;
  357.                }
  358.             }
  359.  
  360.             this.m_hasSingleCell[col] = bFoundSingleCell;
  361.          }
  362.  
  363.          for(int row = 0; row < super.m_children.length; ++row) {
  364.             TableRow rv = (TableRow)super.m_children[row];
  365.  
  366.             for(int col = 0; col < rv.m_children.length; ++col) {
  367.                TableCell cell = (TableCell)rv.m_children[col];
  368.                if (cell != null && cell.m_colSpan > 1) {
  369.                   int minSpan = cell.getMinimumSpan(1);
  370.                   int prefSpan = cell.getPreferredSpan(1);
  371.                   int currentMinSpan = 0;
  372.                   int currentPrefSpan = 0;
  373.                   int start = cell.m_startColumn;
  374.                   int end = cell.m_endColumn;
  375.  
  376.                   for(int i = start; i <= end && i < this.m_minColWidths.length; ++i) {
  377.                      currentMinSpan += this.m_minColWidths[i];
  378.                      currentPrefSpan += this.m_prefColWidths[i];
  379.                   }
  380.  
  381.                   if (currentMinSpan < minSpan) {
  382.                      this.doWeightedDistribution(this.m_minColWidths, start, end, minSpan - currentMinSpan);
  383.                   }
  384.                }
  385.             }
  386.          }
  387.  
  388.       }
  389.    }
  390.  
  391.    int computeRequiredLayoutWidth(float[] pctValues, float totalPctCols, int[] widths) {
  392.       int requiredWidth = 0;
  393.       int nonPctWidths = 0;
  394.  
  395.       for(int i = 0; i < pctValues.length; ++i) {
  396.          if ((double)pctValues[i] > (double)0.0F) {
  397.             int w = (int)((float)widths[i] / pctValues[i]);
  398.             requiredWidth = Math.max(w, requiredWidth);
  399.          } else {
  400.             nonPctWidths += widths[i];
  401.          }
  402.       }
  403.  
  404.       float nonPctCols = 1.0F - totalPctCols;
  405.       int nonPctNeeded = 0;
  406.       if (nonPctCols > 0.0F) {
  407.          nonPctNeeded = (int)((float)nonPctWidths / nonPctCols);
  408.       }
  409.  
  410.       requiredWidth = Math.max(requiredWidth, nonPctNeeded);
  411.       return requiredWidth;
  412.    }
  413.  
  414.    int[] distributeSpace(int[] colWidths, int startCol, int endCol, int amount) {
  415.       int nCols = endCol - startCol + 1;
  416.       int prefSum = 0;
  417.       int colSum = 0;
  418.       boolean bWeighted = true;
  419.  
  420.       for(int i = startCol; i <= endCol; ++i) {
  421.          prefSum += this.m_prefColWidths[i];
  422.          colSum += colWidths[i];
  423.          if (!this.m_hasSingleCell[i]) {
  424.             bWeighted = false;
  425.          }
  426.       }
  427.  
  428.       if (colSum + amount >= prefSum) {
  429.          int[] differences = new int[nCols];
  430.          int i = startCol;
  431.  
  432.          for(int j = 0; i <= endCol; ++j) {
  433.             if (this.m_hasSingleCell[i]) {
  434.                differences[j] = this.m_prefColWidths[i] - colWidths[i];
  435.             } else {
  436.                differences[j] = -1;
  437.             }
  438.  
  439.             ++i;
  440.          }
  441.  
  442.          int space = amount;
  443.          int i = startCol;
  444.  
  445.          for(int j = 0; i <= endCol; ++j) {
  446.             if (differences[j] > 0) {
  447.                colWidths[i] += differences[j];
  448.                space -= differences[j];
  449.             }
  450.  
  451.             ++i;
  452.          }
  453.  
  454.          if (space > 0) {
  455.             colWidths = this.doEvenDistribution(colWidths, startCol, endCol, space);
  456.          }
  457.       } else {
  458.          colWidths = this.doEvenDistribution(colWidths, startCol, endCol, amount);
  459.       }
  460.  
  461.       return colWidths;
  462.    }
  463.  
  464.    int[] doEvenDistribution(int[] colWidths, int startCol, int endCol, int amount) {
  465.       int nCols = endCol - startCol + 1;
  466.  
  467.       do {
  468.          int nDiffs = 0;
  469.          int[] diffs = new int[nCols];
  470.          int i = startCol;
  471.  
  472.          for(int j = 0; i <= endCol; ++j) {
  473.             diffs[j] = this.m_prefColWidths[i] - colWidths[i];
  474.             if (diffs[j] > 0) {
  475.                ++nDiffs;
  476.             }
  477.  
  478.             ++i;
  479.          }
  480.  
  481.          if (nDiffs > 0) {
  482.             int apportion = Math.max(1, amount / nDiffs);
  483.             int i = 0;
  484.  
  485.             for(int j = startCol; i < nCols && amount > 0; ++j) {
  486.                if (diffs[i] > 0) {
  487.                   if (diffs[i] > apportion) {
  488.                      amount -= apportion;
  489.                      colWidths[j] += apportion;
  490.                   } else {
  491.                      amount -= diffs[i];
  492.                      colWidths[j] += diffs[i];
  493.                   }
  494.                }
  495.  
  496.                ++i;
  497.             }
  498.          } else if (amount >= nCols) {
  499.             int origAmount = amount;
  500.             int apportion = amount / nCols;
  501.             int runningTotal = 0;
  502.             int addAmount = 0;
  503.             int i = 0;
  504.  
  505.             for(int j = startCol; i < nCols; ++j) {
  506.                if (i == nCols - 1) {
  507.                   addAmount = origAmount - runningTotal;
  508.                } else {
  509.                   addAmount = apportion;
  510.                }
  511.  
  512.                colWidths[j] += addAmount;
  513.                runningTotal += addAmount;
  514.                amount -= addAmount;
  515.                ++i;
  516.             }
  517.          } else {
  518.             for(int j = startCol; j < amount; ++j) {
  519.                int var10002 = colWidths[j]++;
  520.             }
  521.  
  522.             amount = 0;
  523.          }
  524.       } while(amount > 0);
  525.  
  526.       return colWidths;
  527.    }
  528.  
  529.    boolean doWeightedDistribution(int[] colWidths, int startCol, int endCol, int amount) {
  530.       int nCols = endCol - startCol + 1;
  531.       int prefSum = this.getColumnSum(this.m_prefColWidths);
  532.       int runningTotal = 0;
  533.       int addAmount = 0;
  534.  
  535.       for(int i = startCol; i <= endCol; ++i) {
  536.          if (i == endCol) {
  537.             addAmount = amount - runningTotal;
  538.          } else {
  539.             addAmount = (int)((double)this.m_prefColWidths[i] / (double)prefSum * (double)amount);
  540.          }
  541.  
  542.          colWidths[i] += addAmount;
  543.          runningTotal += addAmount;
  544.       }
  545.  
  546.       return runningTotal == amount;
  547.    }
  548.  
  549.    protected View elementToView(Element e) {
  550.       if (super.m_elem == e) {
  551.          return this;
  552.       } else {
  553.          for(int i = 0; i < super.m_children.length; ++i) {
  554.             View v = super.m_children[i].elementToView(e);
  555.             if (v != null) {
  556.                return v;
  557.             }
  558.          }
  559.  
  560.          for(int i = 0; i < this.m_topCaptions.length; ++i) {
  561.             View v = this.m_topCaptions[i].elementToView(e);
  562.             if (v != null) {
  563.                return v;
  564.             }
  565.          }
  566.  
  567.          for(int i = 0; i < this.m_bottomCaptions.length; ++i) {
  568.             View v = this.m_bottomCaptions[i].elementToView(e);
  569.             if (v != null) {
  570.                return v;
  571.             }
  572.          }
  573.  
  574.          return null;
  575.       }
  576.    }
  577.  
  578.    int getColumnSum(int[] cols) {
  579.       int colSum = 0;
  580.  
  581.       for(int i = 0; i < cols.length; ++i) {
  582.          colSum += cols[i];
  583.       }
  584.  
  585.       return colSum;
  586.    }
  587.  
  588.    public int getMinimumSpan(int axis) {
  589.       if (axis != 1) {
  590.          return 0;
  591.       } else if (super.m_minWidth != -1) {
  592.          return super.m_minWidth;
  593.       } else {
  594.          int m_minWidth = 0;
  595.          this.computePrefMinWidths();
  596.          int[] colWidths = this.computeColumnWidths(0, 1);
  597.  
  598.          for(int i = 0; i < colWidths.length; ++i) {
  599.             m_minWidth += colWidths[i];
  600.          }
  601.  
  602.          m_minWidth += this.m_borderSize * 2 + 2 * this.m_cellSpacing;
  603.          if (this.m_width != -1 && this.m_width > m_minWidth) {
  604.             m_minWidth = this.m_width;
  605.          }
  606.  
  607.          return m_minWidth;
  608.       }
  609.    }
  610.  
  611.    protected int getPreferredSpan(int axis) {
  612.       if (axis != 1) {
  613.          return 0;
  614.       } else if (super.m_prefWidth != -1) {
  615.          return super.m_prefWidth;
  616.       } else {
  617.          int m_prefWidth = 0;
  618.          this.computePrefMinWidths();
  619.          int[] colWidths = this.computeColumnWidths(0, 0);
  620.  
  621.          for(int i = 0; i < colWidths.length; ++i) {
  622.             m_prefWidth += colWidths[i];
  623.          }
  624.  
  625.          m_prefWidth += this.m_cellSpacing * (this.m_nColumns - 1);
  626.          m_prefWidth += this.m_borderSize * 2 + this.m_cellSpacing * 2;
  627.          if (this.m_width != -1 && this.m_width > 0) {
  628.             int specWidth = this.m_width;
  629.             int minWidth = this.getMinimumSpan(1);
  630.             if (m_prefWidth > specWidth && specWidth >= minWidth) {
  631.                m_prefWidth = specWidth;
  632.             } else {
  633.                m_prefWidth = minWidth;
  634.             }
  635.          }
  636.  
  637.          return m_prefWidth;
  638.       }
  639.    }
  640.  
  641.    protected TableRow getRow(int row) {
  642.       return row < super.m_children.length ? (TableRow)super.m_children[row] : null;
  643.    }
  644.  
  645.    protected void increasePreviousCellHeights(TableRow row, int yAmount) {
  646.       int rowIndex;
  647.       for(rowIndex = 0; rowIndex < super.m_children.length; ++rowIndex) {
  648.          TableRow rv = (TableRow)super.m_children[rowIndex];
  649.          if (rv == row) {
  650.             break;
  651.          }
  652.       }
  653.  
  654.       for(int i = 0; i <= rowIndex - 1; ++i) {
  655.          TableRow rv = (TableRow)super.m_children[i];
  656.  
  657.          for(int j = 0; j < rv.m_children.length; ++j) {
  658.             TableCell cell = (TableCell)rv.m_children[j];
  659.             if (rowIndex >= cell.m_startRow && rowIndex <= cell.m_endRow) {
  660.                cell.increaseHeight(yAmount);
  661.             }
  662.          }
  663.       }
  664.  
  665.    }
  666.  
  667.    protected void increaseRowHeight(int row, int amt) {
  668.       if (row < super.m_children.length) {
  669.          TableRow rv = (TableRow)super.m_children[row];
  670.          rv.increaseHeight(amt);
  671.  
  672.          for(int i = row + 1; i < super.m_children.length; ++i) {
  673.             ((TableRow)super.m_children[i]).move(0, amt, true);
  674.          }
  675.  
  676.       }
  677.    }
  678.  
  679.    protected void init() {
  680.       String b = (String)super.m_elem.getAttribute("border");
  681.       if (b == null) {
  682.          this.m_borderSize = 0;
  683.       } else {
  684.          this.m_borderSize = Utilities.setIntegerProperty(1, "border", super.m_elem.getAttributes());
  685.       }
  686.  
  687.       this.m_bgColor = Utilities.setColorProperty((Color)null, "bgcolor", super.m_elem.getAttributes());
  688.       this.m_height = Utilities.setIntegerProperty(-1, "height", super.m_elem.getAttributes());
  689.       this.m_width = Utilities.setIntegerProperty(-1, "width", super.m_elem.getAttributes());
  690.       this.m_pctValue = -1.0F;
  691.       if (this.m_width == -1) {
  692.          this.m_pctValue = Utilities.setPercentageProperty(-1.0F, "width", super.m_elem.getAttributes());
  693.       }
  694.  
  695.       this.m_cellPadding = Utilities.setIntegerProperty(1, "cellpadding", super.m_elem.getAttributes());
  696.       this.m_cellSpacing = Utilities.setIntegerProperty(1, "cellspacing", super.m_elem.getAttributes());
  697.       super.m_alignment = Utilities.setAlignmentProperty(false, -1, "align", super.m_elem.getAttributes());
  698.    }
  699.  
  700.    protected void initCellColumnRowValues() {
  701.       if (super.m_children != null) {
  702.          int nRows = super.m_children.length;
  703.          TableRow currentRow = null;
  704.          Vector occupiedColumns = new Vector();
  705.          this.m_nColumns = 0;
  706.          this.m_nRows = nRows;
  707.          int colPos = 0;
  708.  
  709.          for(int row = 0; row < nRows; ++row) {
  710.             this.m_nColumns = Math.max(this.m_nColumns, colPos);
  711.             colPos = 0;
  712.             this.removeInvalidOccupiedColumns(occupiedColumns, row);
  713.             currentRow = (TableRow)super.m_children[row];
  714.             int rowExtension = currentRow.getBiggestRowSpan();
  715.             this.m_nRows = Math.max(this.m_nRows, row + rowExtension);
  716.             int nRowCells = currentRow.m_children.length;
  717.             int cellIndex = 0;
  718.  
  719.             while(cellIndex < nRowCells) {
  720.                if (this.columnOccupied(occupiedColumns, row, colPos)) {
  721.                   ++colPos;
  722.                } else {
  723.                   TableCell cell = currentRow.getCell(cellIndex);
  724.                   cell.setTableColumns(colPos);
  725.                   colPos += cell.m_colSpan;
  726.                   cell.setTableRows(row);
  727.                   if (cell.m_rowSpan > 1) {
  728.                      RowSpanColumns item = new RowSpanColumns(this);
  729.                      item.columns = new int[cell.m_colSpan];
  730.                      int startCol = cell.m_startColumn;
  731.  
  732.                      for(int j = 0; j < item.columns.length; ++j) {
  733.                         item.columns[j] = startCol + j;
  734.                      }
  735.  
  736.                      item.endRow = cell.m_endRow;
  737.                      occupiedColumns.addElement(item);
  738.                   }
  739.  
  740.                   ++cellIndex;
  741.                }
  742.             }
  743.          }
  744.  
  745.          this.m_nColumns = Math.max(this.m_nColumns, colPos);
  746.       }
  747.    }
  748.  
  749.    protected void initColumnSpecs() {
  750.       this.m_colSpecWidths = new int[this.m_nColumns];
  751.  
  752.       for(int i = 0; i < this.m_colSpecWidths.length; ++i) {
  753.          this.m_colSpecWidths[i] = -1;
  754.       }
  755.  
  756.       this.m_pctColWidths = new float[this.m_nColumns];
  757.  
  758.       for(int i = 0; i < this.m_pctColWidths.length; ++i) {
  759.          this.m_pctColWidths[i] = -1.0F;
  760.       }
  761.  
  762.       for(int col = 0; col < this.m_nColumns; ++col) {
  763.          for(int row = 0; row < super.m_children.length; ++row) {
  764.             TableRow rv = (TableRow)super.m_children[row];
  765.             TableCell cell = rv.getTableColumn(col);
  766.             if (cell != null) {
  767.                String width = (String)((View)cell).getAttribute("width");
  768.                if (width != null) {
  769.                   int idx = width.indexOf("%");
  770.                   if (idx > 0) {
  771.                      width = width.substring(0, idx);
  772.                      Integer iVal = Utilities.getInteger(width);
  773.                      if (iVal != null && iVal > 0 && iVal <= 100) {
  774.                         this.m_pctColWidths[col] = (float)iVal / 100.0F;
  775.                         this.m_bHavePctColumns = true;
  776.                      }
  777.                   } else {
  778.                      this.m_colSpecWidths[col] = Math.max(this.m_colSpecWidths[col], cell.m_width);
  779.                   }
  780.                }
  781.             }
  782.          }
  783.       }
  784.  
  785.    }
  786.  
  787.    protected void initRowSpecs() {
  788.       this.m_rowHeightSpecs = new int[this.m_nRows];
  789.  
  790.       for(int i = 0; i < this.m_nRows; ++i) {
  791.          if (i < super.m_children.length) {
  792.             TableRow rv = (TableRow)super.m_children[i];
  793.             this.m_rowHeightSpecs[i] = rv.getHeightSpec();
  794.          } else {
  795.             this.m_rowHeightSpecs[i] = -1;
  796.          }
  797.       }
  798.  
  799.    }
  800.  
  801.    protected void invalidate() {
  802.       this.m_bPrefMinColsComputed = false;
  803.       super.invalidate();
  804.    }
  805.  
  806.    protected boolean isFloater() {
  807.       return super.m_alignment == 0 || super.m_alignment == 2;
  808.    }
  809.  
  810.    protected boolean isSelfContained() {
  811.       return true;
  812.    }
  813.  
  814.    protected Rectangle layout(int x, int y, int width, LayoutInfo info) {
  815.       super.m_bounds.setBounds(x, y, 0, 0);
  816.       int xPos = x + super.m_insets.left;
  817.       int yPos = y + super.m_insets.top;
  818.       width -= super.m_insets.left + super.m_insets.right + info.leftMargin;
  819.       int layoutWidth = Math.max(0, width);
  820.       if (this.m_width != -1) {
  821.          layoutWidth = this.m_width;
  822.       } else if (this.m_pctValue > 0.0F && this.m_pctValue <= 1.0F) {
  823.          layoutWidth = (int)(this.m_pctValue * (float)width);
  824.       }
  825.  
  826.       layoutWidth -= 2 * this.m_borderSize;
  827.       int cellSpacing = this.m_cellSpacing;
  828.       layoutWidth -= (this.m_nColumns - 1) * cellSpacing + 2 * cellSpacing;
  829.       layoutWidth = Math.max(0, layoutWidth);
  830.       this.computePrefMinWidths();
  831.       this.m_colWidths = this.layoutColumns(layoutWidth, 2);
  832.       this.checkWidthSpecification(layoutWidth);
  833.       xPos += this.m_borderSize + cellSpacing;
  834.       yPos += this.m_borderSize + cellSpacing;
  835.       super.m_bounds = this.layoutRows(xPos, yPos, layoutWidth, info);
  836.       super.m_bounds.x = x;
  837.       super.m_bounds.y = y;
  838.       Rectangle var10000 = super.m_bounds;
  839.       var10000.width += 2 * this.m_borderSize + super.m_insets.left + super.m_insets.right;
  840.       var10000 = super.m_bounds;
  841.       var10000.height += 2 * this.m_borderSize + super.m_insets.top + super.m_insets.bottom;
  842.       this.m_tableBorder = new Rectangle(super.m_bounds);
  843.       Rectangle r = this.layoutCaptions(x, y, super.m_bounds.width, this.m_topCaptions);
  844.       var10000 = super.m_bounds;
  845.       var10000.height += r.height;
  846.       super.m_bounds.width = Math.max(super.m_bounds.width, r.width);
  847.       if (r.height > 0 && super.m_children.length > 0) {
  848.          this.moveRows(r.height, (TableRow)super.m_children[0]);
  849.       }
  850.  
  851.       var10000 = this.m_tableBorder;
  852.       var10000.y += r.height;
  853.       r = this.layoutCaptions(x, super.m_bounds.y + super.m_bounds.height, super.m_bounds.width, this.m_bottomCaptions);
  854.       var10000 = super.m_bounds;
  855.       var10000.height += r.height;
  856.       return super.m_bounds;
  857.    }
  858.  
  859.    Rectangle layoutCaptions(int x, int y, int width, View[] captions) {
  860.       Rectangle bounds = new Rectangle(x, y, 0, 0);
  861.       int xPos = x;
  862.       int yPos = y;
  863.  
  864.       for(int i = 0; i < captions.length; ++i) {
  865.          Rectangle r = captions[i].layout(xPos, yPos, width, new LayoutInfo());
  866.          yPos += r.height;
  867.          bounds.width = Math.max(bounds.width, r.width);
  868.       }
  869.  
  870.       bounds.height = yPos - y;
  871.       return bounds;
  872.    }
  873.  
  874.    int[] layoutColumns(int width, int mode) {
  875.       return this.m_bHavePctColumns ? this.computePercentColumnWidths(width) : this.computeColumnWidths(width, 2);
  876.    }
  877.  
  878.    Rectangle layoutRows(int x, int y, int width, LayoutInfo info) {
  879.       int xPos = x;
  880.       int yPos = y;
  881.       int tableHeight = 0;
  882.       int tableWidth = 0;
  883.       int nValidRows = 0;
  884.       int[] rowHeights = new int[this.m_nRows];
  885.  
  886.       for(int h = 0; h < this.m_nRows; ++h) {
  887.          rowHeights[h] = 0;
  888.       }
  889.  
  890.       for(int row = 0; row < super.m_children.length; ++row) {
  891.          TableRow rv = (TableRow)super.m_children[row];
  892.          rv.m_colWidths = this.m_colWidths;
  893.          Rectangle bounds = rv.layoutSingleRowCells(xPos, yPos, width, info);
  894.          rowHeights[row] = bounds.height;
  895.          if (bounds.height != 0) {
  896.             ++nValidRows;
  897.             yPos += bounds.height;
  898.             yPos += this.m_cellSpacing;
  899.          }
  900.       }
  901.  
  902.       xPos = x;
  903.       yPos = y;
  904.  
  905.       for(int row = 0; row < super.m_children.length; ++row) {
  906.          TableRow rv = (TableRow)super.m_children[row];
  907.          rowHeights = rv.layoutMultiRowCells(xPos, yPos, width, rowHeights, info);
  908.          ++nValidRows;
  909.          yPos += rowHeights[row];
  910.          yPos += this.m_cellSpacing;
  911.       }
  912.  
  913.       if (this.m_height != -1) {
  914.          int tabHeight = 0;
  915.  
  916.          for(int row = 0; row < rowHeights.length; ++row) {
  917.             tabHeight += rowHeights[row];
  918.             if (rowHeights[row] > 0 && this.m_cellSpacing > 0) {
  919.                tabHeight += this.m_cellSpacing;
  920.             }
  921.          }
  922.  
  923.          int[] diffs = new int[rowHeights.length];
  924.  
  925.          while(this.m_height > tabHeight) {
  926.             for(int row = 0; row < rowHeights.length; ++row) {
  927.                int var10002 = rowHeights[row]++;
  928.                var10002 = diffs[row]++;
  929.                ++tabHeight;
  930.                if (tabHeight >= this.m_height) {
  931.                   break;
  932.                }
  933.             }
  934.          }
  935.  
  936.          for(int row = 0; row < super.m_children.length && row < diffs.length; ++row) {
  937.             if (diffs[row] > 0) {
  938.                ((TableRow)super.m_children[row]).increaseHeight(diffs[row]);
  939.                if (row + 1 < super.m_children.length) {
  940.                   this.moveRows(diffs[row], (TableRow)super.m_children[row + 1]);
  941.                }
  942.             }
  943.          }
  944.       }
  945.  
  946.       for(int row = 0; row < super.m_children.length; ++row) {
  947.          rowHeights = ((TableRow)super.m_children[row]).setCellHeights(rowHeights, info);
  948.       }
  949.  
  950.       super.m_bounds.setBounds(x, y, 0, this.m_cellSpacing);
  951.  
  952.       for(int row = 0; row < rowHeights.length; ++row) {
  953.          Rectangle var10000 = super.m_bounds;
  954.          var10000.height += rowHeights[row];
  955.          if (rowHeights[row] > 0 && this.m_cellSpacing > 0) {
  956.             var10000 = super.m_bounds;
  957.             var10000.height += this.m_cellSpacing;
  958.          }
  959.       }
  960.  
  961.       for(int row = 0; row < super.m_children.length; ++row) {
  962.          TableRow rv = (TableRow)super.m_children[row];
  963.          rv.computeCellBorders();
  964.          super.m_bounds.width = Math.max(super.m_bounds.width, ((View)rv).getBounds().width);
  965.       }
  966.  
  967.       Rectangle var31 = super.m_bounds;
  968.       var31.width += 2 * this.m_cellSpacing;
  969.       return super.m_bounds;
  970.    }
  971.  
  972.    protected void loadResources() {
  973.       for(int i = 0; i < super.m_children.length; ++i) {
  974.          super.m_children[i].loadResources();
  975.       }
  976.  
  977.       for(int i = 0; i < this.m_topCaptions.length; ++i) {
  978.          this.m_topCaptions[i].loadResources();
  979.       }
  980.  
  981.       for(int i = 0; i < this.m_bottomCaptions.length; ++i) {
  982.          this.m_bottomCaptions[i].loadResources();
  983.       }
  984.  
  985.    }
  986.  
  987.    protected void makeChildren(ViewFactory factory) {
  988.       int nCount = super.m_elem.getElementCount();
  989.       View[] childViews = new View[nCount];
  990.       int nValidRows = 0;
  991.       Vector topCaptions = new Vector();
  992.       Vector botCaptions = new Vector();
  993.  
  994.       for(int i = 0; i < nCount; ++i) {
  995.          Element childElement = super.m_elem.getElementAt(i);
  996.          if (childElement.getType() == 3) {
  997.             childViews[nValidRows++] = new TableRow(this, childElement, super.m_container);
  998.          } else if (childElement.getType() == 45) {
  999.             boolean bTop = true;
  1000.             String align = (String)childElement.getAttribute("align");
  1001.             if (align != null) {
  1002.                bTop = !align.equalsIgnoreCase("bottom");
  1003.             }
  1004.  
  1005.             View capView = new BlockView(this, childElement, super.m_container);
  1006.             capView.m_alignment = 1;
  1007.             if (bTop) {
  1008.                topCaptions.addElement(capView);
  1009.             } else {
  1010.                botCaptions.addElement(capView);
  1011.             }
  1012.          }
  1013.       }
  1014.  
  1015.       this.m_topCaptions = new View[topCaptions.size()];
  1016.       topCaptions.copyInto(this.m_topCaptions);
  1017.  
  1018.       for(int i = 0; i < this.m_topCaptions.length; ++i) {
  1019.          this.m_topCaptions[i].makeChildren(factory);
  1020.       }
  1021.  
  1022.       this.m_bottomCaptions = new View[botCaptions.size()];
  1023.       botCaptions.copyInto(this.m_bottomCaptions);
  1024.  
  1025.       for(int i = 0; i < this.m_bottomCaptions.length; ++i) {
  1026.          this.m_bottomCaptions[i].makeChildren(factory);
  1027.       }
  1028.  
  1029.       this.m_nDefinedRows = nValidRows;
  1030.       super.m_children = new View[nValidRows];
  1031.  
  1032.       for(int i = 0; i < nValidRows; ++i) {
  1033.          super.m_children[i] = childViews[i];
  1034.       }
  1035.  
  1036.       for(int i = 0; i < super.m_children.length; ++i) {
  1037.          View child = super.m_children[i];
  1038.          if (child != null) {
  1039.             child.makeChildren(factory);
  1040.          }
  1041.       }
  1042.  
  1043.       this.initCellColumnRowValues();
  1044.       this.initColumnSpecs();
  1045.       this.initRowSpecs();
  1046.       this.notifyBorderSize();
  1047.    }
  1048.  
  1049.    protected View modelToView(int pos) {
  1050.       if (pos >= super.m_elem.m_p0 && pos <= super.m_elem.m_p1) {
  1051.          return this;
  1052.       } else {
  1053.          for(int i = 0; i < super.m_children.length; ++i) {
  1054.             View v = super.m_children[i].modelToView(pos);
  1055.             if (v != null) {
  1056.                return v;
  1057.             }
  1058.          }
  1059.  
  1060.          for(int i = 0; i < this.m_topCaptions.length; ++i) {
  1061.             View v = this.m_topCaptions[i].modelToView(pos);
  1062.             if (v != null) {
  1063.                return v;
  1064.             }
  1065.          }
  1066.  
  1067.          for(int i = 0; i < this.m_bottomCaptions.length; ++i) {
  1068.             View v = this.m_bottomCaptions[i].modelToView(pos);
  1069.             if (v != null) {
  1070.                return v;
  1071.             }
  1072.          }
  1073.  
  1074.          return null;
  1075.       }
  1076.    }
  1077.  
  1078.    public void move(int x, int y, boolean bMoveFloaters) {
  1079.       for(int i = 0; i < super.m_children.length; ++i) {
  1080.          super.m_children[i].move(x, y, bMoveFloaters);
  1081.       }
  1082.  
  1083.       Rectangle var10000 = super.m_bounds;
  1084.       var10000.x += x;
  1085.       var10000 = super.m_bounds;
  1086.       var10000.y += y;
  1087.       var10000 = this.m_tableBorder;
  1088.       var10000.x += x;
  1089.       var10000 = this.m_tableBorder;
  1090.       var10000.y += y;
  1091.    }
  1092.  
  1093.    protected void moveRows(int yAmount, TableRow startRow) {
  1094.       for(int i = 0; i < super.m_children.length; ++i) {
  1095.          if (startRow == super.m_children[i]) {
  1096.             for(int j = i; j < super.m_children.length; ++j) {
  1097.                ((TableRow)super.m_children[j]).move(0, yAmount, true);
  1098.             }
  1099.             break;
  1100.          }
  1101.       }
  1102.  
  1103.    }
  1104.  
  1105.    protected void notifyBorderSize() {
  1106.       int cellBorderSize = this.m_borderSize > 0 ? 1 : 0;
  1107.  
  1108.       for(int row = 0; row < super.m_children.length; ++row) {
  1109.          TableRow rv = (TableRow)super.m_children[row];
  1110.  
  1111.          for(int cell = 0; cell < rv.m_children.length; ++cell) {
  1112.             ((TableCell)rv.m_children[cell]).m_borderSize = cellBorderSize;
  1113.          }
  1114.       }
  1115.  
  1116.    }
  1117.  
  1118.    protected int pageBreakAdjust(LayoutInfo info) {
  1119.       int adjustment = 0;
  1120.  
  1121.       for(int row = 0; row < super.m_children.length; ++row) {
  1122.          int rowAdjustment = super.m_children[row].pageBreakAdjust(info);
  1123.          if (rowAdjustment > 0 && row != super.m_children.length - 1) {
  1124.             for(int j = row + 1; j < super.m_children.length; ++j) {
  1125.                super.m_children[j].move(0, rowAdjustment, true);
  1126.             }
  1127.          }
  1128.  
  1129.          adjustment += rowAdjustment;
  1130.       }
  1131.  
  1132.       Rectangle var10000 = super.m_bounds;
  1133.       var10000.height += adjustment;
  1134.       return adjustment;
  1135.    }
  1136.  
  1137.    public void paint(Graphics g, Shape alloc) {
  1138.       Rectangle clip = alloc.getBounds();
  1139.       if (super.m_bounds.intersects(clip)) {
  1140.          for(int i = 0; i < this.m_topCaptions.length; ++i) {
  1141.             this.m_topCaptions[i].paint(g, alloc);
  1142.          }
  1143.  
  1144.          for(int i = 0; i < this.m_bottomCaptions.length; ++i) {
  1145.             this.m_bottomCaptions[i].paint(g, alloc);
  1146.          }
  1147.  
  1148.          for(int i = 0; i < super.m_children.length; ++i) {
  1149.             super.m_children[i].paint(g, alloc);
  1150.          }
  1151.  
  1152.          this.paintBorder(g);
  1153.       }
  1154.  
  1155.    }
  1156.  
  1157.    protected void paintBackground(Graphics g) {
  1158.       if (this.m_bgColor != null && super.m_bounds != null) {
  1159.          Color oldColor = g.getColor();
  1160.          g.setColor(this.m_bgColor);
  1161.          g.fillRect(super.m_bounds.x, super.m_bounds.y, super.m_bounds.width, super.m_bounds.height);
  1162.          g.setColor(oldColor);
  1163.       }
  1164.  
  1165.    }
  1166.  
  1167.    protected void paintBorder(Graphics g) {
  1168.       Color oldColor = g.getColor();
  1169.       int x = this.m_tableBorder.x + super.m_insets.left;
  1170.       int y = this.m_tableBorder.y + super.m_insets.top;
  1171.       int w = this.m_tableBorder.width - 1 - (super.m_insets.left + super.m_insets.right);
  1172.       int h = this.m_tableBorder.height - 1 - (super.m_insets.bottom + super.m_insets.top);
  1173.       g.setColor(Utilities.getBrightBorderColor());
  1174.  
  1175.       for(int i = 0; i < this.m_borderSize; ++i) {
  1176.          g.drawLine(x + i, y + i, x + w - i, y + i);
  1177.          g.drawLine(x + i, y + i, x + i, y + h - i);
  1178.       }
  1179.  
  1180.       g.setColor(Utilities.getDarkBorderColor());
  1181.  
  1182.       for(int i = 0; i < this.m_borderSize; ++i) {
  1183.          g.drawLine(x + i, y + h - i, x + w - i, y + h - i);
  1184.          g.drawLine(x + w - i, y + i, x + w - i, y + h - i);
  1185.       }
  1186.  
  1187.       g.setColor(oldColor);
  1188.    }
  1189.  
  1190.    protected void paintFocusBox(Graphics g, Shape alloc) {
  1191.       Rectangle clip = alloc.getBounds();
  1192.       if (super.m_bounds.intersects(clip)) {
  1193.          for(int i = 0; i < this.m_topCaptions.length; ++i) {
  1194.             this.m_topCaptions[i].paintFocusBox(g, alloc);
  1195.          }
  1196.  
  1197.          for(int i = 0; i < this.m_bottomCaptions.length; ++i) {
  1198.             this.m_bottomCaptions[i].paintFocusBox(g, alloc);
  1199.          }
  1200.  
  1201.          for(int i = 0; i < super.m_children.length; ++i) {
  1202.             super.m_children[i].paintFocusBox(g, alloc);
  1203.          }
  1204.       }
  1205.  
  1206.    }
  1207.  
  1208.    protected void removeInvalidOccupiedColumns(Vector v, int row) {
  1209.       Vector temp = new Vector();
  1210.       Enumeration e = v.elements();
  1211.  
  1212.       while(e.hasMoreElements()) {
  1213.          RowSpanColumns x = (RowSpanColumns)e.nextElement();
  1214.          if (row <= x.endRow) {
  1215.             temp.addElement(x);
  1216.          }
  1217.       }
  1218.  
  1219.    }
  1220.  
  1221.    protected ElementViewInfo viewToModel(int x, int y) {
  1222.       ElementViewInfo info = null;
  1223.       if (super.m_bounds.contains(x, y)) {
  1224.          for(int i = 0; i < super.m_children.length; ++i) {
  1225.             info = super.m_children[i].viewToModel(x, y);
  1226.             if (info != null) {
  1227.                break;
  1228.             }
  1229.          }
  1230.  
  1231.          if (info == null) {
  1232.             for(int i = 0; i < this.m_topCaptions.length; ++i) {
  1233.                info = this.m_topCaptions[i].viewToModel(x, y);
  1234.                if (info != null) {
  1235.                   break;
  1236.                }
  1237.             }
  1238.          }
  1239.  
  1240.          if (info == null) {
  1241.             for(int i = 0; i < this.m_bottomCaptions.length; ++i) {
  1242.                info = this.m_bottomCaptions[i].viewToModel(x, y);
  1243.                if (info != null) {
  1244.                   break;
  1245.                }
  1246.             }
  1247.          }
  1248.  
  1249.          if (info == null) {
  1250.             info = new ElementViewInfo(super.m_elem, this);
  1251.          }
  1252.       }
  1253.  
  1254.       return info;
  1255.    }
  1256. }
  1257.